#!/bin/bash

#------------------------------------------------------------------------------
#Filename:	74843-free.sh
#Version:	1.1
#Date:	        2013/08/05
#Author:	yuanhui.shi
#Email:	        yuanhui.shi@cs2c.com.cn
#Summary:	02.01系统核心功能-06基础命令行工具-23进程工具集-04free查看内存信息
#Notes:	        检查free命令
#Copyright:	China Standard Software Co.,Ltd.
#History:
#	        Version 1.0,2013/08/05
#	        -The first one
#	        Version 1.1,2013/09/09
#	        -Modify the script to satisfy the shell standard
#------------------------------------------------------------------------------


PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

source ../../lib/Echo.sh

function CleanData ()
{
  EchoInfo "74843.sh执行完毕"
}

trap "CleanData" EXIT


EchoInfo "检验free命令是否可用，通过判断total值是否一样。其他信息因为在变，所以没法作为标准"

VAR1=`free |awk 'NR==2 {print $2}'`
VAR2=`cat /proc/meminfo|awk 'NR==1 {print $2}'`

test "${VAR1}" == "${VAR2}" 
EchoResult "free命令得到的MemTotal值是正确的"
